package com.inews.business.service;


import java.util.Date;

import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.inews.base.security.vo.BaseUserVo;
import com.inews.business.entity.TblSysUser;
import com.inews.business.repository.BaseDao;
import com.inews.business.repository.SysUserDao;

@Service
@Transactional(readOnly=true)
public class BaseServiceImpl implements BaseService{
	
	@Autowired
	private BaseDao baseDao;
	@Autowired
	private SysUserDao userDao;
	
	/**
	 * 获取系统时间.
	 *
	 * @return the current time
	 */
	public String getCurrentTime(){
		return baseDao.getSysCurrentTime();
	}
	
	/**
	 * 获取当前用户.
	 *
	 * @param user the user
	 * @return the user
	 */
	public TblSysUser getEditUser(BaseUserVo user){
		return userDao.findOne(user.getUserId());
	}
	
	
	/**
	 * 获取系统时间.
	 *
	 * @return the current time
	 */
	public String getCurrentDate(){
		return  DateFormatUtils.format(new Date(), "yyyy-MM-dd");
	}

}
